<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>确认订单</title>
    <link rel="stylesheet" type="text/css" href="/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="/css/confirm.css"/>
    <link rel="stylesheet" type="text/css" href="/css/mui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/css/loaders.min.css"/>
    <link rel="stylesheet" type="text/css" href="/css/loading.css"/>
	<link rel="stylesheet" href="/js/plugins/dialog/dialog.css">
	<script src="/js/rem.js"></script>
    <script src="/js/jquery.min.js" type="text/javascript"></script>
	<script src="/js/plugins/jrender/jrender.js"></script>
	<script src="/js/plugins/dialog/dialog.min.js"></script>
	<script type="text/javascript">
		sessionStorage.url = "confirm";
		$(window).load(function(){
			$(".loading").addClass("loader-chanage")
			$(".loading").fadeOut(300)
		})
		$(function () {
		    var user = JSON.parse(sessionStorage.getItem("user"));

            var changeMoney =0 - JSON.parse(sessionStorage.getItem("money"));

			$("#count").html(JSON.parse(sessionStorage.getItem("count")));
			$("#money").html(JSON.parse(sessionStorage.getItem("money")));

			var shopCar=JSON.parse(sessionStorage.getItem("shopCar"));
            console.log(shopCar);
            var ids = JSON.parse(sessionStorage.getItem("ids"));


			//点击支付,扣除积分,
			$(".zhifu").click(function () {
				$.post("/money",{"user.id":user.id ,"changeMoney":changeMoney},function (data) {
				    if (data.success){
                        if (shopCar==1){
                            $.each(ids ,function (index,id) {
                                dele(id);
                            })
                            sessionStorage.removeItem("shopCar");
                            console.log("删除购物车");
                        }
				        $(document).dialog({
                            type: "confirm",
                            style: "IOS",
                            content: "交易成功",
                            buttons: [
                                {
                                    name: "回到购物车",
                                    callback: function() {
                                        location.href = "/mine/shopping/shopcar.html";
                                    }
                                },
                                {
                                    name: "回到首页,继续购物",
                                    callback: function() {
                                        location.href = "/mine/shopping/shopindex.html";
                                    }
                                }
                            ]
                        });
					}
                })
            })
        })

		function dele(id) {
            $.ajax({
                type:"DELETE",
                url:"/shopCar/"+id,
                success:function (data) {

                }
            })
        }


	</script>
</head>
<!--loading页开始-->
<div class="loading">
	<div class="loader">
        <div class="loader-inner pacman">
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
        </div>
	</div>
</div>
<!--loading页结束-->
	<body>
		<!--header star-->
		<header class="mui-bar mui-bar-nav" style="background-color: #4D4C4B" id="header">
			<a class="btn" href="javascript:history.go(-1)">
	            <i class="iconfont icon-fanhui"></i>
	        </a>
	        <div class="top-sch-box top-sch-boxtwo flex-col">
	                      扫码支付
	        </div>
	    </header>
	    <!--header end-->
	    
	    <div class="warp warptwo clearfloat product">
	    	<div class="confirm clearfloat"  id="products">
				<div class="tu clearfloat fl">
					<span></span>
					<img src="/images/zhifu.jpg" style="width: 100%" />
				</div>

	    	</div>
	    </div>	    
	    
		<!--settlement star-->
	    <div class="settlement clearfloat">
	    	<div class="zuo clearfloat fl box-s">
	    		共<span id="count">1</span>件  总积分：<span id="money">100000</span>
	    	</div>
	    	<a  class="fl db zhifu ">立即支付</a>
	    </div>
	    <!--settlement end-->
	    
		<!--footer star-->
	    <footer class="page-footer fixed-footer" id="footer">
			<ul>
				<li>
					<a href="/mine/shopping/shopindex.html">
						<i class="iconfont icon-shouye"></i>
						<p>首页</p>
					</a>
				</li>
				<li>
					<a href="cation.html">
						<i class="iconfont icon-icon04"></i>
						<p>分类</p>
					</a>
				</li>
				<li class="active">
					<a href="shopcar.html">
						<i class="iconfont icon-gouwuche"></i>
						<p>购物车</p>
					</a>
				</li>
				<li>
					<a href="center.html">
						<i class="iconfont icon-yonghuming"></i>
						<p>我的</p>
					</a>
				</li>
			</ul>
		</footer>
		<!--footer end-->
	</body>
	
</html>
